package com.eshop.dao;

import com.eshop.pojo.Type;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface TypeDao {
        @Select("select * from type where id=#{id}")
    Type selectById(int id);//根据id查找类型信息

        @Select("select count(*) from type where name=#{name}")
    int selectByName(String name);

        @Select("select * from type where name like concat('%',#{name},'%')")
    List<Type> selectByObject(Type type);//根据对象模糊查找

        @Select("select * from type")
    List<Type> selectAll();//查询所有商品类型

        @Insert("insert into type(name) values(#{name})")
        @Options(useGeneratedKeys = true)
    int add(Type type);//添加商品类型

        @Update("update type set name=#{name} WHERE id = #{id}")
    int update(Type type);//修改商品类型

        @Delete("delete from type where id=#{id}")
    int deleteType(int id);
}
